﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>器具 - 修改</title>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <script src="scripts/boot.js" type="text/javascript"></script>
    

    <style type="text/css">
    html, body
    {        
        padding:0;
        margin:0;
        border:0;
        height:100%;
    }
    </style>
</head>
<body>    
     
    <form id="form1" method="post">
        <input name="id" class="mini-hidden" />
        <input name="fkIndentId" class="mini-hidden" />
        <div style="padding: 10px 0 5px 11px;">
            <table style="table-layout:fixed;">
                <tr>
                    <td style="width:100px;">器具名称：</td>
                    <td style="width:180px;">
                        <input name="sampleName" class="mini-textbox" required="true" emptyText="请输入器具名称" />
                    </td>
                    <td style="width:100px;">型号规格：</td>
                    <td style="width:180px;">
                        <input name="specModel" class="mini-textbox" required="false" emptyText="请输入型号规格" />
                    </td>
                    <td style="width:110px;">器具种类：</td>
                    <td style="width:150px;">
                        <mini-combobox name="dictEquipmentType" showNullItem="false" url="/sign/web/dictionary/val/code/equipmentType" ajaxType="post" textField="name" valueField="val" valueFromSelect="true" required="false"></mini-combobox>
                    </td>
                </tr>
                <tr>
                    <td>制造厂家：</td>
                    <td >
                        <input name="applianceManufacturer" class="mini-textbox" required="false" emptyText="请输入制造厂家" />
                    </td>
                    <td>出厂编号：</td>
                    <td>
                        <input name="sampleFactoryNumber" class="mini-textbox" required="false" emptyText="请输入出厂编号" />
                    </td>
                    <td>数量单位：</td>
                    <td>
                        <mini-combobox name="dictAAUs" showNullItem="false" url="/sign/web/dictionary/val/code/aAUs" ajaxType="post" textField="name" valueField="val" valueFromSelect="true" required="false"></mini-combobox>
                    </td>
                </tr>
                <tr>
                    <td>出厂日期：</td>
                    <td >
                        <input name="dateOfProduction" class="mini-datepicker" required="false" emptyText="请选择日期" />
                    </td>
                    <td>检定需时：</td>
                    <td>
                        <input name="verificationTimeRequired" class="mini-textbox" required="false" emptyText="请输入检定需时" />
                    </td>
                    <td>强制检定：</td>
                    <td>
                        <mini-combobox name="dictVerification" showNullItem="false" url="/sign/web/dictionary/val/code/verification" ajaxType="post" textField="name" valueField="val" valueFromSelect="true" required="false"></mini-combobox>
                    </td>
                </tr>
                <tr>
                    <td>商定完成日期：</td>
                    <td >
                        <input name="agreedCompletionDate" class="mini-datepicker" required="false" emptyText="请选择日期" />
                    </td>
                    <td>证书编号：</td>
                    <td>
                        <input name="certificateNo" class="mini-textbox" required="false" emptyText="请输入证书编号" />
                    </td>
                    <td>器具状态：</td>
                    <td>
                        <mini-combobox name="dictApplianceStatus" showNullItem="false" url="/sign/web/dictionary/val/code/applianceStatus" ajaxType="post" textField="name" valueField="val" valueFromSelect="true" required="false"></mini-combobox>
                    </td>
                </tr>
                <tr>
                    <td>检定/校准依据：</td>
                    <td >
                        <input name="calibrationBasis" class="mini-textbox" required="false" emptyText="请输入检定/校准依据" />
                    </td>
                    <td>主检人：</td>
                    <td>
                        <input name="principalInspector" class="mini-textbox" required="false" emptyText="请输入主检人" />
                    </td>
                    <td>法定类别：</td>
                    <td>
                        <mini-combobox name="dictLegalCategory" showNullItem="false" url="/sign/web/dictionary/val/code/legalCategory" ajaxType="post" textField="name" valueField="val" valueFromSelect="true" required="false"></mini-combobox>
                    </td>
                </tr>
                <tr>
                    <td>审核人：</td>
                    <td >
                        <input name="reviewedBy" class="mini-textbox" required="false" emptyText="请输入审核人" />
                    </td>
                    <td>签发人：</td>
                    <td>
                        <input name="issuer" class="mini-textbox" required="false" emptyText="请输入签发人" />
                    </td>
                    <td>取证书方式：</td>
                    <td>
                        <mini-combobox name="dictCertificateMethod" showNullItem="false" url="/sign/web/dictionary/val/code/certificateMethod" ajaxType="post" textField="name" valueField="val" valueFromSelect="true" required="false"></mini-combobox>
                    </td>
                </tr>
                <tr>
                    <td>签发日期：</td>
                    <td >
                        <input name="issuerDate" class="mini-datepicker" required="false" emptyText="请选择日期" />
                    </td>
                    <td>标准收费：</td>
                    <td>
                        <input name="standardCharges" class="mini-textbox" required="false" emptyText="请输入标准收费" />
                    </td>
                    <td>专业：</td>
                    <td>
                        <mini-combobox name="dictSpeciality" showNullItem="false" url="/sign/web/dictionary/val/code/speciality" ajaxType="post" textField="name" valueField="val" valueFromSelect="true" required="false"></mini-combobox>
                    </td>
                </tr>
                <tr>
                    <td>登记号(数量)：</td>
                    <td >
                        <input name="sampleNo" class="mini-textbox" required="false" emptyText="请输入登记号(数量)" />
                    </td>
                    <td>附件明细：</td>
                    <td>
                        <input name="fj" class="mini-textbox" required="false" emptyText="请输入附件明细" />
                    </td>
                    <td>校准证书是否需要给出校准周期：</td>
                    <td>
                        <mini-combobox name="dictJzzq" showNullItem="true" url="/sign/web/dictionary/val/code/jzzq" ajaxType="post" textField="name" valueField="val" valueFromSelect="true" required="false"></mini-combobox>
                    </td>
                </tr>
                <tr>
                    <td>外观说明：</td>
                    <td >
                        <mini-combobox name="dictWgsm" showNullItem="false" url="/sign/web/dictionary/val/code/wgsm" ajaxType="post" textField="name" valueField="val" valueFromSelect="true" required="true"></mini-combobox>
                    </td>
                    <td>技术指标：</td>
                    <td>
                        <input name="sampleTechFeature" class="mini-textbox" required="false" emptyText="请输入技术指标" />
                    </td>
                    <td>校准证书是否需要给出合格判定：</td>
                    <td>
                        <mini-combobox name="dictJzpd" showNullItem="true" url="/sign/web/dictionary/val/code/jzpd" ajaxType="post" textField="name" valueField="val" valueFromSelect="true" required="false"></mini-combobox>
                    </td>
                </tr>
                <tr>
                    <td>检测类型：</td>
                    <td >
                        <mini-combobox name="dictReportType" showNullItem="true" url="/sign/web/dictionary/val/code/reportType" ajaxType="post" textField="name" valueField="val" valueFromSelect="true" required="true"></mini-combobox>
                    </td>
                    <td>检测费用：</td>
                    <td>
                        <input name="testingCosts" class="mini-textbox" required="false" emptyText="请输入检测费用" />
                    </td>
                    <td>数量：</td>
                    <td>
                        <input name="number" class="mini-textbox" required="false" emptyText="请输入数量" />
                    </td>
                </tr>
                <tr>
                    <td>承检科室：</td>
                    <td >
                        <mini-combobox name="dictTestDepartment" showNullItem="true" url="/sign/web/dictionary/val/code/testDepartment" ajaxType="post" textField="name" valueField="val" valueFromSelect="true" required="true"></mini-combobox>
                    </td>
                    <td>预计完成日期：</td>
                    <td>
                        <input name="wantCompleteDate" class="mini-datepicker" required="false" emptyText="请选择日期" />
                    </td>
                    <td>其他要求：</td>
                    <td>
                        <input name="otherRequirement" class="mini-textbox" required="false" emptyText="请输入其他要求" />
                    </td>
                </tr>
                <tr>
                    <td>计量器具<br>领取人：</td>
                    <td >
                        <input name="receiverOfMeasuringInstruments" class="mini-textbox" required="false" emptyText="请输入计量器具领取人" />
                    </td>
                    <td>计量器具<br>领取日期：</td>
                    <td>
                        <input name="receiverOfMeasuringInstrumentsDate" class="mini-datepicker" required="false" emptyText="请选择日期" />
                    </td>
                    <td>备注：</td>
                    <td>
                        <input name="description" class="mini-textbox" required="false" emptyText="请输入备注" />
                    </td>
                </tr>
                <tr>
                    <td>证书领取人：</td>
                    <td >
                        <input name="certificateRecipient" class="mini-textbox" required="false" emptyText="请输入证书领取人" />
                    </td>
                    <td>证书领取日期：</td>
                    <td>
                        <input name="certificateRecipientDate" class="mini-datepicker" required="false" emptyText="请选择日期" />
                    </td>
                    <td></td>
                    <td>
                    </td>
                </tr>
            </table>
        </div>
        <div style="text-align:center;padding:10px;">
            <a class="mini-button" onclick="onOk" style="width:60px;margin-right:20px;">确定</a>       
            <a class="mini-button" onclick="onCancel" style="width:60px;">取消</a>
        </div>
    </form>
    <script type="text/javascript">
        mini.parse();

        var form = new mini.Form("form1");

        function SaveData() {
            var o = form.getData();
            form.validate();
            if (form.isValid() == false) return;

            o.dateOfProduction = mini.formatDate(o.dateOfProduction,'yyyy-MM-dd');
            o.agreedCompletionDate = mini.formatDate(o.agreedCompletionDate,'yyyy-MM-dd');
            o.issuerDate = mini.formatDate(o.issuerDate,'yyyy-MM-dd');
            o.wantCompleteDate = mini.formatDate(o.wantCompleteDate,'yyyy-MM-dd');
            o.receiverOfMeasuringInstrumentsDate = mini.formatDate(o.receiverOfMeasuringInstrumentsDate,'yyyy-MM-dd');
            o.certificateRecipientDate = mini.formatDate(o.certificateRecipientDate,'yyyy-MM-dd');
            // o.日期字段 = mini.formatDate(o.日期字段,'yyyy-MM-dd');
            // var json = mini.encode([o]);
            $.ajax({
                url: "/sign/bus/utensil/updateById",
		        type: 'post',
                data:JSON.stringify(o),
                dataType:"json",
                contentType: "application/json;charset=UTF-8",
                cache: false,
                success: function (text) {
                    CloseWindow("save");
                },
                error: function (jqXHR, textStatus, errorThrown) {
                    alert(jqXHR.responseText);
                    CloseWindow();
                }
            });
        }

        ////////////////////
        //标准方法接口定义
        function SetData(data) {
            if (data.action == "edit") {
                //跨页面传递的数据对象，克隆后才可以安全使用
                data = mini.clone(data);

                $.ajax({
                    url: "/sign/bus/utensil/id/" + data.id,
                    type: "post",
                    cache: false,
                    success: function (text) {
                        var o = mini.decode(text);
                        form.setData(o.data);
                        if(o.data.dictWgsm != null) mini.getbyName("dictWgsm").setValue(o.data.dictWgsm.value);
                        if(o.data.dictReportType != null) mini.getbyName("dictReportType").setValue(o.data.dictReportType.value);
                        if(o.data.dictTestDepartment != null) mini.getbyName("dictTestDepartment").setValue(o.data.dictTestDepartment.value);
                        if(o.data.dictJzzq != null) mini.getbyName("dictJzzq").setValue(o.data.dictJzzq.value);
                        if(o.data.dictJzpd != null) mini.getbyName("dictJzpd").setValue(o.data.dictJzpd.value);

                        if(o.data.dictEquipmentType != null) mini.getbyName("dictEquipmentType").setValue(o.data.dictEquipmentType.value);
                        if(o.data.dictAAUs != null) mini.getbyName("dictAAUs").setValue(o.data.dictAAUs.value);
                        if(o.data.dictVerification != null) mini.getbyName("dictVerification").setValue(o.data.dictVerification.value);
                        if(o.data.dictApplianceStatus != null) mini.getbyName("dictApplianceStatus").setValue(o.data.dictApplianceStatus.value);
                        if(o.data.dictLegalCategory != null) mini.getbyName("dictLegalCategory").setValue(o.data.dictLegalCategory.value);
                        if(o.data.dictCertificateMethod != null) mini.getbyName("dictCertificateMethod").setValue(o.data.dictCertificateMethod.value);
                        if(o.data.dictSpeciality != null) mini.getbyName("dictSpeciality").setValue(o.data.dictSpeciality.value);
                        form.setChanged(false);
                    }
                });
            }
        }

        function GetData() {
            var o = form.getData();
            return o;
        }
        function CloseWindow(action) {            
            if (action == "close" && form.isChanged()) {
                if (confirm("数据被修改了，是否先保存？")) {
                    return false;
                }
            }
            if (window.CloseOwnerWindow) return window.CloseOwnerWindow(action);
            else window.close();            
        }
        function onOk(e) {
            SaveData();
        }
        function onCancel(e) {
            CloseWindow("cancel");
        }
        //////////////////////////////////

    </script>
</body>
</html>
